package com.iot.core.data.service;


import com.iot.core.data.entity.HtError;
import com.iot.core.data.mapper.HtErrorMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


@Service
@Slf4j
public class HtErrorService extends  ServiceImpl<HtErrorMapper, HtError> implements IHtErrorService {

    @Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor =Exception.class	)
    @Async
    @Override
    public void saveLogAsync(HtError m)    {

        try {
            getMapper().insert(m);
        }
        catch(Exception ex){
            ex.printStackTrace();
            log.error(ex.getMessage() );
        }

    }

}
